<?php

/**
 * Prado Portal.
 *
 * @author Steen Rabol <steen.rabol@gmail.com>
 * @link http://www.pradoportal.dk/
 * @copyright Copyright &copy; 2006,2007,2008 Steen Rabol
 * @license http://www.pradoportal.dk
 * @version $Id: TOpenIdLink.php 423 2011-01-05 10:04:11Z steen.rabol $
 *
 */

Prado::using('System.Web.UI.WebControls.THyperLink');

class TOpenIdLink extends THyperLink
{
	const	OpenIdLogo	= 'openid-icon-small.gif';
	private $_publishedAssetsUrl;

	//
	// We need to publish the OpenId logo
	public function onPreRender($param)
	{
		$path		= PortalUtil::PathName(Prado::getPathOfNamespace('Application.Common.3rdParty.OpenId.assets'));
        $publish	= $path . self::OpenIdLogo;
		$this->_publishedAssetsUrl = Prado::getApplication()->getAssetManager()->publishFilePath($publish);
	}

	public function renderContents($writer)
	{
		$img = "<img src=\"" . $this->_publishedAssetsUrl . "\" border=\"0\" alt=\"OpenId\" />";
		$writer->write($img);
		$writer->write(THttpUtility::htmlEncode($this->Text));
	}
}
?>
